<html>
<body>
<a href="http://man.chinaunix.net"><< Back to man.ChinaUnix.net </a><br><br>
<B><FONT color=#000000><FONT size=+2>Linux Shortcuts and 
Commands:</FONT></FONT></B><B><FONT color=#000000><FONT 
size=+2></FONT></FONT></B> 
<P><A href="http://linux-newbie.sunsite.dk/">Linux Newbie Administrator 
Guide</A> <BR>by Stan and Peter Klimas 
<P>This is a practical selection of the commands we use most often. Press 
<TT>&lt;Tab&gt;</TT> to see the listing of all available command (on your PATH). 
On my small home system, it says there are 2595 executables on my PATH.&nbsp; 
Many of these "commands" can be accessed from your favourite GUI front-end 
(probably KDE or Gnome) by clicking on the right menu or button. They can all be 
run from the command line.&nbsp; Programs that require GUI have to be run from a 
terminal opened under a GUI. 
<P><B>Legend:</B> <BR>&lt;&gt; = single special or function key on the keyboard. 
For example &lt;Ctrl&gt; indicates the "control" key. <BR><I>italic</I> = name 
of the file or variable you probably want to substitute with your own. 
<BR><TT>fixed width</TT> = in-line Linux commands and filenames. 
<P><B>Notes for the UNIX Clueless:</B> <BR>1. LINUX IS CASE-SENSITIVE. For 
example: Netscape, NETSCAPE and nEtscape are three different commands. Also 
my_filE, my_file, and my_FILE are three different files. Your user login name 
and password are also case sensitive. (This goes with the tradition of UNIX and 
the "c" programming language being case sensitive.) <BR>2. Filenames can be up 
to 256 characters long and can contain letters, numbers, "." (dot), "_" 
(underscore), "-" (dash), plus some other not recommended characters. <BR>3. 
Files with names starting with "." are normally not shown by the <TT>ls</TT> 
(list) or dir commands. Think of these files as "hidden". Use <TT>ls 
-a</TT>&nbsp; (list with the option "all") to see these files. <BR>4. "/" is an 
equivalent to DOS "\" (root directory, meaning the parent of all other 
directories). <BR>5. Under Linux, all directories appear under a single 
directory tree (there are no DOS-style drive letters). <BR>6. In a configuration 
file, a line starting with # is a comment. 
<H2><A name=shortcuts></A>7.1 Linux essential shortcuts and sanity 
commands</H2><TT>&lt;Ctrl&gt;&lt;Alt&gt;&lt;F1&gt;</TT> <BR>Switch to the first 
text terminal. Under Linux you can have several (6 in standard setup) terminals 
opened at the same time. 
<P><TT>&lt;Ctrl&gt;&lt;Alt&gt;&lt;Fn&gt; </TT>(n=1..6) <BR>Switch to the nth 
text terminal. 
<P><TT>tty</TT> <BR>Print the name of the terminal in which you are typing this 
command. 
<P><TT>&lt;Ctrl&gt;&lt;Alt&gt;&lt;F7&gt;</TT> <BR>Switch to the first GUI 
terminal (if X-windows is running on this terminal). 
<P>&nbsp;<TT>&lt;Ctrl&gt;&lt;Alt&gt;&lt;Fn&gt; </TT>(n=7..12) <BR>Switch to the 
nth GUI terminal (if a GUI terminal is running on screen n-1). On default, 
nothing is running on terminals <BR>8 to 12, but you can run another server 
there. 
<P>&nbsp;<TT>&lt;Tab&gt;</TT> <BR>(In a text terminal) Autocomplete the 
command&nbsp; if there is only one option, or else show all the available 
options. <BR>THIS SHORTCUT IS GREAT! It even works at LILO prompt! 
<P>&nbsp;<TT>&lt;ArrowUp&gt;</TT> <BR>Scroll and edit the command history. Press 
&lt;Enter&gt; to execute. 
<P>&nbsp;<TT>&lt;Shift&gt;&lt;PgUp&gt;</TT> <BR>Scroll terminal output up. Work 
also at the login prompt, so you can scroll through your bootup messages. 
<P>&nbsp;<TT>&lt;Shift&gt;&lt;PgDown&gt;</TT> <BR>Scroll terminal output down. 
<P>&nbsp;<TT>&lt;Ctrl&gt;&lt;Alt&gt;&lt;+&gt;</TT> <BR>(in X-windows) Change to 
the next X-server resolution (if you set up the X-server to more than one 
resolution). For multiple resolutions on my standard SVGA card/monitor, I have 
the following line in the file <TT>/etc/X11/XF86Config</TT> (the first 
resolution starts on default, the largest determines the size of the "virtual 
screen"): <BR><TT>Modes "1024x768" "800x600" "640x480" "512x384" "480x300" 
"400x300" "1152x864"</TT> 
<P><TT>&lt;Ctrl&gt;&lt;Alt&gt;&lt;-&gt;</TT> <BR>(in X-windows) Change to the 
previous X-server resolution. 
<P><TT>&lt;Ctrl&gt;&lt;Alt&gt;&lt;BkSpc&gt;</TT> <BR>(in X-windows) Kill the 
current X-windows server. Use if the X-windows server crushes and cannot be 
exited normally. 
<P><TT>&lt;Ctrl&gt;&lt;Alt&gt;&lt;Del&gt;</TT> <BR>Shut down the system and 
reboot. This is the normal shutdown command for a user at the text-mode console. 
Don't just press the "reset" button for shutdown! 
<P><TT>&lt;Ctrl&gt;c</TT> <BR>Kill the current process (mostly in the text mode 
for small applications). 
<P><TT>&lt;Ctrl&gt;d</TT> <BR>Log out from the current terminal.&nbsp; See also 
the next command. 
<P><TT>&lt;Ctrl&gt;d</TT> <BR>Send [End-of-File] to the current process. Don't 
press it twice else you also log out (see the previous command). 
<P><TT>&lt;Ctrl&gt;s</TT> <BR>Stop the transfer to the terminal. 
<P><TT>&lt;Ctrl&gt;q</TT> <BR>Resume the transfer to the terminal. Try if your 
terminal mysteriously stops responding. 
<P><TT>&lt;Ctrl&gt;z</TT> <BR>Send the current process to the background. 
<P><TT>exit</TT> <BR>Logout. I can also use <TT>logout</TT> for the same 
effect.&nbsp; (If you have started a second shell, e.g., using <TT>bash</TT> the 
second shell will be exited and you will be back in the first shell, not logged 
out.) 
<P><TT>reset</TT> <BR>Restore a screwed-up terminal (a terminal showing funny 
characters) to default setting. Use if you tried to "cat" a binary file. You may 
not be able to see the command as you type it. 
<P><TT>&lt;MiddleMouseButton&gt;</TT> <BR>Paste the text which is currently 
highlighted somewhere else. This is the normal "copy-paste" operation in 
Linux.&nbsp; (It doesn't work with Netscape and WordPerfect which use the MS 
Windows-style "copy-paste". It does work in the text terminal if you enabled 
"gpm" service using "setup".) Best used with a Linux-ready 3-button mouse 
(Logitech or similar) or else set "3-mouse button emulation"). 
<P><TT>~</TT> <BR>(tilde) My home directory (normally the directory 
<TT>/home/my_login_name</TT>). For example, the command <TT>cd 
~/<I>my_dir</I></TT> will change my working&nbsp; directory to the subdirectory 
"<I>my_dir</I>" under my home directory.&nbsp; Typing just "cd" alone is an 
equivalent of the command "cd ~". 
<P><TT>.</TT> <BR>(dot) Current directory. For example, <TT>./my_program</TT> 
will attempt to execute the file "my_program" located in your current working 
directory. 
<P><TT>..</TT> <BR>(two dots) Directory parent to the current one. For example, 
the command <TT>cd ..</TT> will change my current working directory one one 
level up. 
<H2><A name=sys_info_commands></A>7.2 Common Linux commands--system 
info</H2><TT>pwd</TT> <BR>Print working directory, i.e., display the name of my 
current directory on the screen. 
<P><TT>hostname</TT> <BR>Print the name of the local host (the machine on which 
you are working). Use<TT> netconf </TT>(as root) to change the name of the 
machine. 
<P><TT>whoami</TT> <BR>Print my login name. 
<P><TT>id <I>username</I></TT> <BR>Print user id (uid) and his/her group id 
(gid), effective id (if different than the real id) and the supplementary 
groups. 
<P><TT>date</TT> <BR>Print or change the operating system date and time. E.g., I 
could change the date and time to 2000-12-31 23:57 using this command: 
<BR><TT>date 123123572000</TT> <BR>To set the hardware (BIOS) clock from the 
system (Linux) clock, use the command (as root) <TT>setclock</TT> 
<P><TT>time</TT> <BR>Determine the amount of time that it takes for a process to 
complete + other info. Don't confuse it with the <TT>date</TT> command. E.g. I 
can find out how long it takes to display a directory content using: 
<BR><TT>time ls</TT> 
<P><TT>who</TT> <BR>Determine the users logged on the machine. 
<P><TT>rwho -a</TT> <BR>(=remote who) Determine all users logged on your 
network. The rwho service must be enabled for this command to run. If it isn't, 
run setup as root to enable "rwho". 
<P><TT>finger <I>user_name</I></TT> <BR>System info about a user. Try: 
<TT>finger root</TT> 
<P><TT>last</TT> <BR>Show listing of users last logged-in on your system. 
<P><TT>history | more</TT> <BR>Show the last (1000 or so) commands executed from 
the command line on the current account. The "| more" causes the display to stop 
after each screenful. 
<P><TT>uptime</TT> <BR>Show the amount of time since the last reboot. 
<P><TT>ps</TT> <BR>(=print status) List the processes currently run by the 
current user. 
<P><TT>ps axu | more</TT> <BR>List all the processes currently running, even 
those without the controlling terminal, together with the name of the user that 
owns each process. 
<P><TT>top</TT> <BR>Keep listing the currently running processes, sorted by cpu 
usage (top users first). In KDE, you can get GUI-based Ktop from "K"menu under 
"System"-"Task Manager" (or by executing "ktop" in an X-terminal). 
<P><TT>uname -a</TT> <BR>(= Unix name with option "all") Info on your (local) 
server. I can also use <TT>guname</TT> (in X-window terminal) to display the 
info more nicely. 
<P><TT>free</TT> <BR>Memory info (in kilobytes). 
<P><TT>df -h</TT> <BR>(=disk free) Print disk info about all the filesystems (in 
human-readable form) 
<P><TT>du / -bh | more</TT> <BR>(=disk usage) Print detailed disk usage for each 
subdirectory starting at the "/" (root) directory (in human legible form). 
<P><TT>cat /proc/cpuinfo</TT> <BR>Cpu info--it show the content of the file 
<TT>cpuinfo</TT>. Note that the files in the <TT>/proc</TT> directory are not 
real files--they are hooks to look at information available to the kernel. 
<P><TT>cat /proc/interrupts</TT> <BR>List the interrupts in use. 
<P><TT>cat /proc/version</TT> <BR>Linux version and other info 
<P><TT>cat /proc/filesystems</TT> <BR>Show the types of filesystems currently in 
use. 
<P><TT>cat /etc/printcap</TT> <BR>Show the setup of printers. 
<P><TT>lsmod</TT> <BR>(As root. Use <TT>/sbin/lsmod</TT> to execute this command 
when you are a non-root user.) Show the kernel modules currently loaded. 
<P><TT>set|more</TT> <BR>Show the current user environment. 
<P><TT>echo $PATH</TT> <BR>Show the content of the environment variable "PATH". 
This command can be used to show other environment variables as well. Use "set" 
to see the full environment. 
<P><TT>dmesg | less</TT> <BR>Print kernel messages (the content of the so-called 
kernel ring buffer). Press "q" to quit "less". Use <TT>less 
/var/log/dmesg</TT>&nbsp; to see what "dmesg" dumped into this file right after 
the last system bootup. <BR>&nbsp; 
<H2><A name=Basic_operations></A>7.3 Basic operations</H2><TT><I>any_command 
</I>--help |more</TT> <BR>Display a brief help on a command (works with most 
commands). "--help" works similar to DOS "/h" switch. The "more" pipe is needed 
if the output is longer than one screen. 
<P><TT>man <I>topic</I></TT> <BR>Display the contents of the system manual pages 
(help) on the topic. Try <TT>man man</TT> first. Press "q" to quit the viewer. 
The command <TT>info <I>topic</I></TT> works similar and may contain more 
up-to-date information. Manual pages can be hard to read. Try 
<TT><I>any_command</I> --help</TT> for short, easy to digest help on a command. 
If more info needed, have a look to the directory <TT>/usr/doc</TT>. To display 
manual page from a specific section, I may use something like in this 
example:&nbsp; <TT>man 3 exit</TT> (this displays an info on the command 
<TT>exit</TT> from section 3 of the manual pages). 
<P><TT>apropos <I>topic</I></TT> <BR>Give me the list of the commands that have 
something to to do with my topic. 
<P><TT>help command</TT> <BR>Display brief info on a bash (shell) build-in 
command. 
<P><TT>ls</TT> <BR>List the content of the current directory. Under Linux, the 
command "dir" is an alias to ls. Many users have "ls" to be an alias to "ls 
--color". 
<P><TT>ls -al |more</TT> <BR>List the content of the current directory, all 
files (also those starting with a dot), and in a long form. Pipe the output 
through the "more" command, so that the display pauses after each screenful. 
<P><TT>cd <I>directory</I></TT> <BR>Change directory. Using "cd" without the 
directory name will take you to your home directory. "cd -" will take you to 
your previous directory and is a convenient way to toggle between two 
directories. "cd .." will take you one directory up. 
<P><TT>cp <I>source destination</I></TT> <BR>Copy files. E.g., <TT>cp 
/home/stan/existing_file_name .</TT>&nbsp; will copy a file to my current 
working directory. Use the "-r" option (for recursive) to copy the contents of 
whole directories, e.g. , <TT>cp -r my_existing/dir/ ~&nbsp;</TT> will copy a 
subdirectory under my current working directory to my home directory. 
<P><TT>mcopy <I>source destination</I></TT> <BR>Copy a file from/to a DOS 
filesystem (no mounting necessary). E.g., <TT>mcopy a:\autoexec.bat ~/junk 
</TT>. See <TT>man mtools</TT> for related commands: mdir, mcd, mren, mmove, 
mdel, mmd, mrd, mformat .... 
<P><TT>mv s<I>ource destination</I></TT> <BR>Move or rename files. The same 
command is used for moving and renaming files and directories. 
<P><TT>ln <I>source destination</I></TT> <BR>Create a hard link called 
<I>destination</I> to the file called <I>source</I>. The link appears as a copy 
of the original files, but in reality only one copy of the file is kept, just 
two (or more) directory entries point to it. Any changes the file are 
automatically visible throughout. When one directory entry is removed, the 
other(s) stay(s) intact. The limitation of the hard links are: the files have to 
be on the same filesystem, hard links to directories or special files are 
impossible. 
<P><TT>ln -s <I>source destination</I></TT> <BR>Create a symbolic (soft) link 
called "destination" to the file called "source". The symbolic link just 
specifies a path where to look for the file. In contradistinction to hard links, 
the source and destination don't not have to tbe on the same filesystem. In 
comparison to hard links, the drawback of symbolic links are: if the original 
file is removed, the link is "broken", symbolic links can also create circular 
references (like circular references in spreadsheets or databases, e.g., "a" 
points to "b" and "b" points back to "a"). 
<P><TT>rm<I> files</I></TT> <BR>Remove (delete) files. You must own the file in 
order to be able to remove it. On many systems, you will be asked or 
confirmation of deleation, if you don't want this, use the "-f" (=force) option, 
e.g., <TT>rm -f *</TT>&nbsp; will remove all files in my current working 
directory, no questions asked. 
<P><TT>mkdir <I>directory</I></TT> <BR>Make a new directory. 
<P><TT>rmdir <I>directory</I></TT> <BR>Remove an empty directory. 
<P><TT>rm -r <I>files</I></TT> <BR>(recursive remove) Remove files, directories, 
and their subdirectories. Careful with this command as root--you can easily 
remove all files on the system with such a command executed on the top of your 
directory tree, and there is no undelete in Linux (yet). But if you really 
wanted to do it (reconsider), here is how (as root): <TT>rm -rf /*</TT> 
<P><TT>cat <I>filename</I> | more</TT> <BR>View the content of a text file 
called "filename", one page a time. The "|" is the "pipe" symbol (on many 
American keyboards it shares the key with "\") The pipe makes the output stop 
after each screenful. For long files, it is sometimes convenient to use the 
commands head and tail that display just the beginning and the end of the file. 
If you happened to use "cat" a binary file and your terminal displays funny 
characters afterwards, you can restore it with the command "reset". 
<P><TT>less <I>filename</I></TT> <BR>Scroll through a content of a text file. 
Press q when done. "Less" is roughly equivalent to "more" , the command you know 
from DOS, although very often "less" is more convenient than "more". 
<P><TT>pico <I>filename</I></TT> <BR>Edit a text file using the simple and 
standard text editor called <TT>pico</TT>. 
<P><TT>pico -w <I>filename</I></TT> <BR>Edit a text file, while disabling the 
long line wrap. Handy for editing configuration files, e.g. <TT>/etc/fstab</TT>. 

<P><TT>find / -name "<I>filename</I>"</TT> <BR>Find the file called "filename" 
on your filesystem starting the search from the root directory "/". The 
"filename" may contain wildcards (*,?). 
<P><TT>locate <I>filename</I></TT> <BR>Find the file name of which contains the 
string "filename". Easier and faster than the previous command but depends on a 
database that normally rebuilds at night. 
<P><TT>./<I>program_name</I></TT> <BR>Run an executable in the current 
directory, which is not on your PATH. 
<P><TT>touch <I>filename</I></TT> <BR>Change the date/time stamp of the file 
<I><TT>filename</TT></I> to the current time. Create an empty file if the file 
does not exist. 
<P><TT>xinit</TT> <BR>Start a barebone X-windows server (without a windows 
manager). 
<P><TT>startx</TT> <BR>Start an X-windows server and the default windows 
manager. Works like typing "win" under DOS with Win3.1 
<P><TT>startx -- :1</TT> <BR>Start another X-windows session on the display 1 
(the default is opened on display 0). You can have several GUI terminals running 
concurrently. Switch between them using &lt;Ctrl&gt;&lt;Alt&gt;&lt;F7&gt;, 
&lt;Ctrl&gt;&lt;Alt&gt;&lt;F8&gt;, etc. 
<P><TT>xterm</TT> <BR>(in X terminal) Run a simple X-windows terminal.&nbsp; 
Typing <TT>exit</TT> will close it.&nbsp; There are other, more advanced 
"virtual" terminals for X-windows. I like the popular ones: <TT>konsole</TT> and 
<TT>kvt</TT> (both come with kde) and <TT>gnome-terminal</TT> (comes with 
gnome).&nbsp; If you need something really fancy-looking, try <TT>Eterm</TT>. 
<P><TT>xboing</TT> <BR>(in X terminal). Very nice, old-fashioned game. Many 
small games/programs are probably installed on your system. I also like 
<TT>xboard</TT> (chess). 
<P><TT>shutdown -h now</TT> <BR>(as root) Shut down the system to a halt. Mostly 
used for a remote shutdown. Use &lt;Ctrl&gt;&lt;Alt&gt;&lt;Del&gt; for a 
shutdown at the console (which can be done by any user). 
<P><TT>halt</TT> <BR><TT>reboot</TT> <BR>(as root, two commands) Halt or reboot 
the machine. Used for remote shutdown, simpler to type than the previous 
command. <BR>&nbsp; 
<H2>Network apps</H2><TT>netscape</TT> <BR>(in X terminal) Run netscape 
(requires a separate Netscape installation). The current versions of Netscape 
(4.x) are known to be big and buggy. They occasionally crash by vanishing (no 
other harm done). Also, when not connected to the network , Netscape likes to 
refuse to do anything (looks like it hanged)-it revives when you connect. 
<P><TT>netscape -display <I>host</I>:0.0</TT> <BR>(in X terminal) Run netscape 
on the current machine and direct the output to machine named "host" display 0 
screen 0. Your current machine must have a permission to display on the machine 
"host" (typically given by executing the command <TT>xhost 
<I>current_machine_name</I></TT> in the xterminal of the machine host. Other 
X-windows program can be run remotely the same way. 
<P><TT>lynx <I>file.html</I></TT> <BR>View an html file or browse the net from 
the text mode. 
<P><TT>pine</TT> <BR>A good text-mode mail reader. Another good and standard one 
is <TT>elm</TT>. Your Netscape mail will read the mail from your Internet 
account. <TT>pine</TT> will let you read the "local" mail, e.g. the mail your 
son or a cron process sends to you from a computer on your home network. The 
command <TT>mail</TT> could also be used for reading/composing mail, but it 
would be inconvenient--it is meant to be used in scripts for automation. 
<P><TT>elm</TT> <BR>A good tex-mode mail reader. See the previous command. 
<P><TT>mutt</TT> <BR>A really basic but extremally useful and fast mail reader. 
<P><TT>mail</TT> <BR>A basic operating system tool for e-mail. Look at the 
previous commands for a better e-mail reader. <TT>mail</TT> is good if you 
wanted to send an e-mail from a shell script. 
<P><TT>licq</TT> <BR>(in X term) An icq "instant messaging" client. Another good 
one is <TT>kxicq</TT>. Older distributions don't have an icq client installed, 
you have to do download one and install it. 
<P><TT>talk <I>username1</I></TT> <BR>Talk to another user currently logged on 
your machine (or use "<TT>talk <I>username1</I>@<I>machinename</I></TT>" to talk 
to a user on a different computer) . To accept the invitation to the 
conversation, type the command "<TT>talk <I>username2</I></TT>". If somebody is 
trying to talk to you and it disrupts your work, your may use the command 
"<TT>mesg n</TT>" to refuse accepting messages. You may want to use 
"<TT>who</TT>" or "<TT>rwho</TT>" to determine the users who are currently 
logged-in. 
<P><TT>mc</TT> <BR>Launch the "Midnight Commander" file manager (looks like 
"Norton Commander" for Linux). 
<P><TT>telnet <I>server</I></TT> <BR>Connect to another machine using the TELNET 
protocol. Use a remote machine name or IP address. You will be prompted for your 
login name and password--you must have an account on the remote machine to 
login. Telnet will connect you to another machine and let you operate on it as 
if you were sitting at its keyboard (almost). Telnet is not very 
secure--everything you type goes in open text, even your password! 
<P><TT>rlogin <I>server</I></TT> <BR>(=remote login) Connect to another machine. 
The login name/password from your current session is used; if it fails you are 
prompted for a password. 
<P><TT>rsh <I>server</I></TT> <BR>(=remote shell) Yet another way to connect to 
a remote machine. The login name/password from your current session is used; if 
it fails you are prompted for a password. 
<P><TT>ftp <I>server</I></TT> <BR>Ftp another machine. (There is also 
<TT>ncftp</TT> which adds extra features and <TT>gftp</TT> for GUI .) Ftp is 
good for copying files to/from a remote machine. Try user "anonymous" if you 
don't have an account on the remote server. After connection, use "?" to see the 
list of available ftp commands.&nbsp; The essential ftp command are: <TT>ls</TT> 
(see the files on the remote system), <TT>ASCII</TT>, <TT>binary</TT> (set the 
file transfer mode to either text or binary, important that you select the 
proper one ), <TT>get</TT> (copy a file from the remote system to the local 
system), <TT>mget</TT> (get many files at once), <TT>put</TT> (copy a file from 
the local system to the remote system), <TT>mput</TT> (put many files at once), 
<TT>bye</TT> (disconnect). For automation in a script, you may want to use 
<TT>ncftpput</TT> and <TT>ncftpget</TT>, for example: <BR><TT>ncftpput -u 
my_user_name -p my_password -a remote.host.domain remote_dir *local.html</TT> 
<P><TT>minicom</TT> <BR>Minicom program (looks like "Procomm for Linux"). 
<H2>File (de)compression</H2><TT>tar -zxvf <I>filename.tar.gz</I></TT> 
<BR>(=tape archiver) Untar a tarred and compressed tarball (*.tar.gz or *.tgz) 
that you downloaded from the Internet. 
<P><TT>tar -xvf <I>filename.tar</I></TT> <BR>Untar a tarred but uncompressed 
tarball (*.tar). 
<P><TT>gunzip <I>filename.gz</I></TT> <BR>Decompress a zipped file (*.gz" or 
*.z). Use gzip (also <TT>zip</TT> or <TT>compress</TT>) if you wanted to 
compress files to this file format. 
<P><TT>bunzip2 <I>filename.bz2</I></TT> <BR>(=big unzip) Decompress a file 
(*.bz2) zipped with bzip2 compression utility. Used for big files. 
<P><TT>unzip <I>filename.zip</I></TT> <BR>Decompress a file (*.zip) zipped with 
a compression utility compatible with PKZIP for DOS. 
<P><TT>unarj e <I>filename.arj</I></TT> <BR>Extract the content of an *.arj 
archive. 
<P><TT>uudecode -o <I>outputfile</I> <I>filename</I></TT> <BR>Decode a file 
encoded with <TT>uuencode</TT>.&nbsp; uu-encoded files are typically used for 
transfer of non-text files in e-mail (uuencode transforms any file into an ASCII 
file). 
<H2><A name=process_control></A>7.4 Process control</H2><TT><FONT 
size=+0>ps</FONT></TT> <BR><FONT size=+0>(=print status) Display the list of 
currently running processes with their process IDs (PID) numbers. Use <TT>ps 
axu</TT> to see all processes currently running on your system (also those of 
other users or without a controlling terminal), each with the name of the owner. 
Use "top" to keep listing the processes currently running.</FONT> 
<P><TT>fg <I>PID</I></TT> <BR>Bring a background or stopped process to the 
foreground. 
<P><TT>bg <I>PID</I></TT> <BR>Send the process to the background. Opposite to 
fg. The same can be accomplished with &lt;Ctrl&gt;z.&nbsp; If you have stopped 
jobs, you have to type <TT>exit</TT> twice in row to log out. 
<P><TT><I>any_command</I>&amp;</TT> <BR>Run any command in the background (the 
symbol "&amp;" means "run the proceeding command in the background"). 
<P><TT>batch <I>any_command</I></TT> <BR>Run any command (usually one that is 
going to take more time) when the system load is low. I can logout, and the 
process will keep running. 
<P><TT>at 17:00</TT> <BR>Execute a command at a specified time.&nbsp; You will 
be prompted for the command(s) to run, until you press &lt;Ctrl&gt;d. 
<P><TT>kill <I>PID</I></TT> <BR>Force a process shutdown. First determine the 
PID of the process to kill using ps. 
<P><TT>killall <I>program_name</I></TT> <BR>Kill program(s) by name. 
<P><TT>xkill</TT> <BR>(in an xwindow terminal) Kill a GUI-based program with 
mouse. (Point with your mouse cursor at the window of the process you want to 
kill and click.) 
<P><TT>lpc</TT> <BR>(as root) Check and control the printer(s). Type "?" to see 
the list of available commands. 
<P><TT>lpq</TT> <BR>Show the content of the printer queue. Under KDE 
(X-Windows), you may use GUI-based "Printer Queue" available from 
"K"menu-Utilities. 
<P><TT>lprm <I>job_number</I></TT> <BR>Remove a printing job "job_number" from 
the queue. 
<P><TT>nice <I>program_name</I></TT> <BR>Run <I>program_name</I> adjusting its 
priority. Since the priority is not specified in this example, it will be 
adjusted by 10 (the process will run slower), from the default value (usually 
0). The lower the number (of "niceness" to other users on the system), the 
higher the priority. The priority value may be in the range -20 to 19. Only root 
may specify negative values. Use "top" to display the priorities of the running 
processes. 
<P><TT>renice -1 <I>PID</I></TT> <BR>(as root) Change the priority of a running 
process to -1. Normal users can only adjust processes they own, and only up from 
the current value (make them run slower). 
<P><TT>&lt;Ctrl&gt;c</TT>, <TT>&lt;Ctrl&gt;z</TT>, <TT>&lt;Ctrl&gt;s</TT>, and 
<TT>&lt;Ctrl&gt;q</TT> also belong to this chapter but they were described <A 
href="http://www.unixguide.net/linux/linuxshortcuts.shtml#shortcuts">previously</A>. 
In short they mean: stop the current command, send the current command to the 
background, stop the data transfer, resume the data transfer. <BR>&nbsp; 
<H2><A name=Admin_commands></A>7.5 Basic administration 
commands</H2><TT>printtool</TT> <BR>(as root in X-terminal) Configuration tool 
for your printer(s). Settings go to the file <TT>/etc/printcap</TT>. 
<P><TT>setup</TT> <BR>(as root) Configure mouse, soundcard, keyboard, X-windows, 
system services. There are many distibution-specific configuration utilities, 
<TT>setup</TT> is the default on RedHat. Mandrake 7.0 offers very nice 
<TT>DrakConf</TT> . 
<P><TT>linuxconfig</TT> <BR>(as root, either in text or graphical mode). You can 
access and change hundreds of setting from it. Very powerful--don't change too 
many things at the same time, and be careful with changing entries you don't 
understand. 
<P><TT>xvidtune</TT> <BR>(in X-terminal). Adjust the settings of the graphical 
display for all resolutions so as to eliminate black bands, shift the display 
right/left/up/down, etc. (First use the knobs on your monitor to fit your text 
mode correctly on the screen.) To make the changes permanent, display the 
frequencies on the screen and transfer them to the setup file 
<TT>/etc/X11/XF86Config</TT>. 
<P><TT>alias ls="ls --color=tty"</TT> <BR>Create an alias for the command "ls" 
to enhance its format with color. In this example, the alias is also called "ls" 
and the "color" option is only envoke when the output is done to a terminal (not 
to files). Put the alias into the file <TT>/etc/bashrc</TT> if you would like 
the alias to be always accessible to all users on the system. Type 
"<TT>alias</TT>" alone to see the list of aliases on your system. 
<P><TT>adduser <I>user_name</I></TT> <BR>Create a new account (you must be 
root). E.g.,&nbsp; <TT>adduser barbara&nbsp;</TT> Don't forget to set up the 
password for the new user in the next step. The user home directory is 
<TT>/home/<I>user_name</I>.</TT> 
<P><TT>useradd <I>user_name</I></TT> <BR>The same as the command " <TT>adduser 
<I>user_name</I> "</TT>. 
<P><TT>userdel <I>user_name</I></TT> <BR>Remove an account (you must be a root). 
The user's home directory and the undelivered mail must be dealt with separately 
(manually because you have to decide what to do with the files). 
<P><TT>groupadd <I>group_name</I></TT> <BR>Create a new group on your system. 
Non-essential but can be handy even on a home machine with a small number of 
users. 
<P><TT>passwd</TT> <BR>Change the password on your current account. If you are 
root, you can change the password for any user using:&nbsp; <TT>passwd 
<I>user_name</I></TT> 
<P><I><TT>chmod perm filename</TT></I> <BR>(=change mode) Change the file access 
permission for the files you own (unless you are root in which case you can 
change any file). You can make a file accessible in three modes: read (r), write 
(w), execute (x) to three classes of users: owner (u), members of the same group 
as the owner (g), others on the system (o). Check the current access permissions 
using: <BR><TT>ls -l <I>filename</I></TT> <BR>If the file is accessible to all 
users in all modes it will show: <BR><TT>rwxrwxrwx</TT> <BR>The first triplet 
shows the file permission for the owner of the file, the second for his/her 
group, the third for others. A "no" permission is shown as "-". <BR>E.g., this 
command will <B>add </B>the permission to read the file "junk" to all 
(=user+group+others): <BR><TT>chmod a+r junk</TT> <BR>This command will remove 
the permission to execute the file junk from others: <BR><TT>chmod o-x junk</TT> 
<BR>Also try <A 
href="http://sunsite.auc.dk/share/page/FAQ2.htm#file_permissions">here</A> for 
more info. <BR>You can set the default file permissions for the news files that 
you create using the command <TT>umask</TT> (see <TT>man umask</TT>). 
<P><TT>chown <I>new_ownername filename</I></TT> <BR><TT>chgrp <I>new_groupname 
filename</I></TT> <BR>Change the file owner and group. You should use these two 
commands after you copy a file for use by somebody else. 
<P><TT>su</TT> <BR>(=substitute user id) Assume the superuser (=root) identity 
(you will be prompted for the password). Type "exit" to return you to your 
previous login. Don't habitually work on your machine as root. The root account 
is for administration and the su command is to ease your access to the 
administration account when you require it. You can also use "su" to assume any 
other user identity, e.g. <TT>su barbara</TT> will make me "barbara" (password 
required unless I am a superuser). 
<P><TT>kernelcfg</TT> <BR>(as root in X terminal). GUI to to add/remove kernel 
modules. You can do the same from the command line using the command 
"<TT>insmod</TT>", but "<TT>insmode</TT>" is less "newbie-friendly". 
<P><TT>lsmod</TT> <BR>List currently loaded kernel modules. A module is like a 
device driver--it provides operating system kernel support for a particular 
piece of hardware or feature. 
<P><TT>modprobe -l |more</TT> <BR>List all the modules available for your 
kernel. The available modules are determined by how your Linux kernel was 
compliled. Every possible module/feature can be compiled on linux as either 
"hard wired" (fast, non-removable), "module" (maybe slower, but loaded/removable 
on demand), or "no" (no support for this feature at all). 
<P><TT>insmod parport</TT> <BR><TT>insmod ppa</TT> <BR>(as root) Insert modules 
into the kernel (a module is roughly an equivalent of a DOS device driver). This 
example shows how to insert the modules for support of the external parallel 
port zip drive (it appears to be a problem to get the external zip drive to 
work&nbsp; in any other way under RH6.0 ). 
<P><TT>rmmod <I>module_name</I></TT> <BR>(as root, not essential). Remove the 
module <I>module_name</I> from the kernel. 
<P><TT>setserial /dev/cua0 port 0x03f8 irq 4</TT> <BR>(as root) Set a serial 
port to a non-standard setting. The example here shows the standard setting for 
the first serial port (cua0 or ttyS0). The standard PC settings for the second 
serial port (cua1or ttyS1) are: address of i/o port 0x02f8, irq 3. The third 
serial port (cua2 or ttyS2): 0x03e8, irq 4. The forth serial port (cua3 or 
ttyS3): 0x02e8, irq 3. Add your setting to <TT>/etc/rc.d/rc.local</TT> if you 
want it to be set at the boot time. See man setserial for good a overview. 
<P><TT>fdisk</TT> <BR>(as root) Linux hard drive partitioning utility (DOS has a 
utility with the same name). 
<P><TT>cd /usr/src/linux-2.0.36</TT> <BR><TT>make xconfig</TT> <BR>(as root in X 
terminal). Nice GUI front-end for configuration of the kernel options in 
preparation for compilation of your customized kernel.&nbsp; (The directory name 
contains the version of your Linux kernel so you may need to modify the 
directory name if your Linux kernel version is different than 2.0.36 used in 
this example. You also need the "Tk" interpreter and the kernel source code 
installed. ) The alternatives to "make xconfig" are: "make config"&nbsp; (runs a 
scripts that asks you questions in the text mode) and "make menuconfig" (runs a 
text-based menu-driven configuration utility). Try: <TT>less 
/usr/doc/HOWTO/Kernel-HOWTO</TT> for more information. <BR>After the 
configuration,&nbsp; you may choose to proceed with kernel compilation of the 
new kernel by issuing the following commands: <BR><TT>make dep</TT> <BR><TT>make 
zImage</TT> <BR>The last command will take some time to complete (maybe 0.5 h, 
depending on your hardware). It produces the file "zImage", which is your new 
Linux kernel. Next: <BR><TT>make modules</TT> <BR><TT>make modules_install</TT> 
<BR>Read: /usr/doc/HOWTO/Kernel-HOWTO for information on how to install the new 
kernel. You will probably also find it useful to read "man depmode". 
Configuration, compilation and installation of a new kernel is not difficult but 
it CAN lead to problems if you don't know what you are doing. <BR>Compilation of 
a kernel is a good way to test your hardware, because it involves a massive 
amount of computing. If your hardware is "flaky", you will most likely receive 
the "signal 11" error (read the beatiful 
<TT>/usr/doc/FAQ/txt/GCC-SIG11-FAQ</TT>). <B>See <A 
href="http://sunsite.auc.dk/share/page/kernel_upgrade.htm">this</A> for details 
on kernel upgrade.</B> 
<P><TT>depmod -a</TT> <BR>(as root) Build the module dependency table for the 
kernel. This can, for example, be useful after installing and booting a new 
kernel. Use "<TT>modprobe -a</TT>" to load the modules. 
<P><TT>ldconfig</TT> <BR>(as root) Re-create the bindings and the cache for the 
loader of dynamic libraries ("ld"). You may want to run ldconfig after an 
installation of new dynamically linked libraries on your system. (It is also 
re-run every time you boot the computer, so if you reboot you don't have to run 
it manually.) 
<P><TT>mknod /dev/fd0 b 2 0</TT> <BR>(=make node, as root) Create a device file. 
This example shows how to create a device file associated with your first floppy 
drive and could be useful if you happened to accidentally erase it. The options 
are: b=block mode device (c=character mode device, p=FIFO device, u=unbuffered 
character mode device). The two integers specify the major and the minor device 
number. 
<P><TT>fdformat /dev/fd0H1440</TT> <BR><TT>mkfs -c -t ext2</TT> <BR>(=floppy 
disk format, two commands, as root) Perform a low-level formatting of a floppy 
in the first floppy drive (/dev/fd0), high density (1440 kB). Then make a Linux 
filesystem (-t ext2), checking/marking bad blocks (-c ). Making the files system 
is an equivalent to the high-level format. 
<P><TT>badblocks /dev/fd01440 1440</TT> <BR>(as root) Check a high-density 
floppy for bad blocks and display the results on the screen. The parameter 
"1440" specifies that 1440 blocks are to be checked. This command does not 
modify the floppy. 
<P><TT>fsck -t ext2 /dev/hda2</TT> <BR>(=file system check, as root) Check and 
repair a filesystem. The example uses the partition hda2, filesystem type ext2. 
<P><TT>dd if=/dev/fd0H1440 of=floppy_image</TT> <BR><TT>dd if=floppy_image 
of=/dev/fd0H1440</TT> <BR>(two commands, dd="data duplicator") Create an image 
of a floppy to the file called "floppy_image" in the current directory. Then 
copy <TT>floppy_image</TT> (file) to another floppy disk. Works like DOS 
"DISKCOPY". <BR>&nbsp; 
<H2>Program installation</H2><TT>rpm -ivh<I> filename.rpm</I></TT> 
<BR>(=RedhatPackageManager, install, verbose, hashes displayed to show progress, 
as root.) Install a content of RedHat rpm package(s) and print info on what 
happened. Keep reading if you prefer a GUI installation. 
<P><TT>rpm -qpi <I>filename.rpm</I></TT> <BR>(=RedhatPackageManager, query, 
package, list.) Read the info on the content of a yet uninstalled package 
<I>filename.rpm</I>. 
<P><TT>rpm -qpl <I>filename.rpm</I></TT> <BR>(=RedhatPackageManager, query, 
package, information.) List the files contained in a yet uninstalled package 
<I>filename.rpm</I>. 
<P><TT>rpm -qf <I>filename</I></TT> <BR>(=RedhatPackageManager, query, file.) 
Find out the name of the *.rpm package to which the file <I>filename</I> (on 
your hardrive) belongs. 
<P><TT>rpm -e <I>packagename</I></TT> <BR>(=RedhatPackageManager, 
erase=uninstall.) Uninstall a package <I>pagckagename</I>. <I>Packagname</I> is 
the same as the beginning of the *.rpm package file but without the dash and 
version number. 
<P><TT>kpackage</TT> <BR><TT>gnorpm</TT> <BR><TT>glint</TT> <BR>(in X terminal, 
as root if you want to be able to install packages) GUI fronts to the Red Hat 
Package Manager (rpm). "glint" comes with RH5.2, "gnorpm" with RH6.0, "kpackage" 
comes with RH6.1 or must be installed separately but is the best of the three. 
Use any of them to view which software packages are installed on your system and 
the what not-yet-installed packages are available on your RedHat CD, display the 
info about the packages, and install them if you want (installation must be done 
as root). <BR>&nbsp; 
<H2>Accessing drives/partitions</H2><TT>mount</TT> <BR>See <A 
href="http://sunsite.auc.dk/share/page/FAQ.htm#Where_drives">here</A> for 
details on mounting drives.&nbsp; Examples are shown in the next commands. 
<P><TT>mount -t auto /dev/fd0 /mnt/floppy</TT> <BR>(as root) Mount the floppy. 
The directory <TT>/mnt/floppy</TT> must exist, be empty and NOT be your current 
directory. 
<P><TT>mount -t auto /dev/cdrom /mnt/cdrom</TT> <BR>(as root) Mount the CD. You 
may need to create/modify the <TT>/dev/cdrom</TT> file depending where your 
CDROM is. The directory <TT>/mnt/cdrom</TT> must exist, be empty and NOT be your 
current directory. 
<P><TT>mount /mnt/floppy</TT> <BR>(as user or root) Mount a floppy as user. The 
file <TT>/etc/fstab</TT> must be set up to do this. The directory 
<TT>/mnt/floppy</TT> must not be your current directory. 
<P><TT>mount /mnt/cdrom</TT> <BR>(as user or root) Mount a CD as user. The file 
<TT>/etc/fstab</TT> must be set up to do this. The directory <TT>/mnt/cdrom</TT> 
must not be your current directory. 
<P><TT>umount /mnt/floppy</TT> <BR>Unmount the floppy. The directory 
<TT>/mnt/floppy</TT> must not be your (or anybody else's) current working 
directory. Depending on your setup, you might not be able to unmount a drive 
that you didn't mount. <BR>&nbsp; 
<H2><A name=Net_tools></A>7.6 Network administration tools</H2><TT>netconf</TT> 
<BR>(as root) A very good menu-driven setup of your network. 
<P><TT>ping<I>machine_name</I></TT> <BR>Check if you can contact another machine 
(give the machine's name or IP), press &lt;Ctrl&gt;C when done (it keeps going). 

<P><TT>route -n</TT> <BR>Show the kernel routing table. 
<P><TT>nslookup <I>host_to_find</I></TT> <BR>Query your default domain name 
server (DNS) for an Internet name (or IP number) <I>host_to_find</I>. This way 
you can check if your DNS works. You can also find out the name of the host of 
which you only know the IP number. 
<P><TT>traceroute <I>host_to_trace</I></TT> <BR>Have a look how you messages 
trave to <I><TT>host_to_trace</TT></I> (which is either a host name or IP 
number). 
<P><TT>ipfwadm -F -p m</TT> <BR>(for RH5.2, seen next command for RH6.0) Set up 
the firewall IP forwarding policy to masquerading. (Not very secure but simple.) 
Purpose: all computers from your home network will appear to the outside world 
as one very busy machine and, for example, you will be allowed to browse the 
Internet from all computers at once. 
<P><TT>echo 1 &gt; /proc/sys/net/ipv4/ip_forward</TT> <BR><TT>ipfwadm-wrapper -F 
-p deny</TT> <BR><TT>ipfwadm-wrapper -F -a m -S xxx.xxx.xxx.0/24 -D 
0.0.0.0/0</TT> <BR>(three commands, RH6.0). Does the same as the previous 
command. Substitute&nbsp; the "x"s&nbsp; with digits of your class "C" IP 
address that you assigned to your home network. See <A 
href="http://sunsite.auc.dk/share/page/FAQ.htm#masquerading">here</A> for more 
details. In RH6.1, masquarading seems broken to me--I think I will install 
Mandrake Linux:). 
<P><TT>ifconfig</TT> <BR>(as root) Display info on the network interfaces 
<U>currently active</U> (ethernet, ppp, etc). Your first ethernet should show up 
as eth0, second as eth1, etc, first ppp over modem as ppp0, second as ppp1, etc. 
The "lo" is the "loopback only" interface which should be always active. Use the 
options (see <TT>ifconfig --help</TT>) to configure the interfaces. 
<P><TT>ifup <I>interface_name</I></TT> <BR>(<TT>/sbin/ifup</TT> to it run as a 
user) Startup a network interface. E.g.: <BR><TT>ifup eth0</TT> <BR><TT>ifup 
ppp0</TT> <BR>Users can start up or shutdown the ppp interface only when the 
right permission was checked during the ppp setup (using <TT>netconf</TT> ). To 
start a ppp interface (dial-up connection), I normally use kppp available under 
kde menu "internet". 
<P><TT>ifdown <I>interface_name</I></TT> <BR>(<TT>/sbin/ifdown</TT> to run it as 
a user). Shut down the network interface. E.g.: <TT>ifdown ppp0 </TT>Also, see 
the previous command. 
<P><TT>netstat | more</TT> <BR>Displays a lot (too much?) information on the 
status of your network. <BR>&nbsp; 
<H2>Music-related commands</H2><TT>cdplay play 1</TT> <BR>Play the first track 
from a audio CD. 
<P><TT>eject</TT> <BR>Get a free coffee&nbsp; cup holder :))).&nbsp;&nbsp; 
(Eject the CD ROM tray). 
<P><TT>play <I>my_file.wav</I></TT> <BR>Play a wave file. 
<P><TT>mpg123 <I>my_file.mp3</I></TT> <BR>Play an mp3 file. 
<P><TT>mpg123 -w <I>my_file.wav my_file.mp3</I></TT> <BR>Create a wave audio 
file from an mp3 audio file. 
<P><TT>knapster</TT> <BR>(in X terminal) Start the program to downolad mp3 files 
that other users of napster have displayed for downloading. Really cool! 
<P><TT>cdparanoia -B&nbsp; "1-"</TT> <BR>(CD ripper)&nbsp; Read the contents of 
an audio CD and save it into wavefiles in the current directories, one track per 
wavefile.&nbsp; The "1-" <BR>means "from track 1 to the last". -B forces putting 
each track into a separate file. 
<P><TT>playmidi <I>my_file.mid</I></TT> <BR>Play a midi file.&nbsp; <TT>playmidi 
-r <I>my_file.mid</I></TT>&nbsp; will display text mode effects on the screen. 
<P><TT>sox</TT> <BR>(argument not given here) Convert from almost any audio file 
format to another (but not mp3s).&nbsp; See <TT>man sox</TT>. <BR>&nbsp; 
<H2>Graphics-related commands</H2><TT>kghostview <I>my_file.ps</I></TT> 
<BR>Display a postscript file on screen.&nbsp; I can also use the older-looking 
<TT>ghostview</TT> or <TT>gv</TT> for the same end effect. 
<P><TT>ps2pdf my_file.ps my_file.pdf</TT> <BR>Make a pdf (Adobe portable 
document format) file from a postscript file. 
<P><TT>gimp</TT> <BR>(in X terminal) A humble looking but very powerful image 
processor. Takes some learning to use, but it is great for artists, there is 
almost nothing you can't do with gimp. Use your mouse right button to get local 
menus, and learn how to use layers. Save your file in the native gimp file 
format *.xcf (to preserve layers) and only then flatten it and save as png (or 
whatever).&nbsp; There is a large user manual /usr/ 
<P><TT>gphoto</TT> <BR>(in X terminal) Powerful photo editor. 
<P><TT>giftopnm <I>my_file.giff</I> &gt; <I>my_file.pnm</I></TT> 
<BR><TT>pnmtopng <I>my_file.pnm</I> &gt; <I>my_file.png</I></TT> <BR>Convert the 
propriatory giff graphics into a raw, portable pnm file. Then convert the pnm 
into a png file, which is a newer and better standard for Internet 
pictures&nbsp; (better technically plus there is no danger of being sued by the 
owner of giff patents).<A 
href="http://sunsite.auc.dk/linux-newbie/index.htm"></A> 
<hr>
<P>
	
</body>
</html>


